//index.js
//获取应用实例
var app = getApp()

Page({
  
  

  data: {
    onLoad: function () { },
    hiddenmodalput: true, 
    _child:"",
    disabled:false,
    gjz:"",
  },
  cha:function(e){
    this.setData({
      gjz: e.detail.value
    })

  },
  search:function(){
    var that = this;
    var gjz=this.data.gjz;
    wx.navigateTo({
      url: '../search/search?gjz=' + gjz
    });

  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function () {
    console.log('onLoad')
    var that = this
    wx.request({
      url: 'http://139.199.105.136/lovewall/show', //仅为示例，并非真实的接口地址
      data: {},
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        var data = res.data;
        var num=1;
        for(var i in data){
          if(data[num]!=null){num++;}

        }
        var Industry = new Array();
        
        var len=(num-2);
        
        for (var nu=0;nu<len;nu++) {
          
            Industry[nu] = data[len-nu];
           
            console.log(Industry)
          
        }

        console.log(res.data)
        that.setData({
          Industry: Industry
        })
      },
      fail: function (err) {
        console.log(err)
      }
    })
  },
  /**
  * 生命周期函数--监听页面初次渲染完成
  */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
if(app.globalData.bo){
  app.globalData.bo=false;
  var that = this
  wx.request({
    url: 'http://139.199.105.136/lovewall/show', //仅为示例，并非真实的接口地址
    data: {},
    header: {
      'content-type': 'application/json'
    },
    success: function (res) {


      console.log(res.data)
      that.setData({
        Industry: res.data
      })
    },
    fail: function (err) {
      console.log(err)
    }
  })
}
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  showDetail(event) {
    console.log("event")
    console.log(event)
    //console.log("now")
    //console.log()
    wx.navigateTo({
      url: '../entry/entry?id=' + event.currentTarget.id,
      fail:function(){
        console.log("fail")
      },
      success:function(){
        console.log("succeed")
      }
    });
  },
  onPullDownRefresh(){
    var that = this
  wx.request({
      url: 'http://139.199.105.136/lovewall/show', //仅为示例，并非真实的接口地址
      data: {},
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {


        console.log(res.data)
        that.setData({
          Industry: res.data
        })
      },
      fail: function (err) {
        console.log(err)
      }
    })
  }
})
